﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CodeAuto.Pages
{
    public partial class TableDelete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int tableId = Convert.ToInt32(Request["tableid"]);
            string projectId = Request["docid"];
            Models.T_Table table = new Models.T_Table();
            table.Id = tableId;
            DavidDB.ADO.DBManager db = new DavidDB.ADO.DBManager();
            db.Delete(table);

            Models.T_Field field = new Models.T_Field();
            field.TableId = tableId;
            db.DeleteColumByKey_Value(field);


            db.Commit();
            db.Dispose();
            Response.Redirect("ProjectTables.aspx?docid=" + projectId);
        }
    }
}